# -*-coding:utf-8-*-
"""
    ʵ���Զ�������xml�ļ������������Զ�������;
    Ŀǰ����֧���Զ��������ű�;
    version 1.0
    data 2015/12/23
"""
__author__ = 'wangleijie'
#
# class mytest(object):
#
#     dict_a = {'a':1,'b':2}
#     dict_b = {'a':1,'b':2}
#
#     def func_test(self):
#         if self.dict_a is self.dict_b:
#             print "is ok"
#         if self.dict_a == self.dict_b:
#             print "== ok"
#         if type(self.dict_b) == type(self.dict_b):
#             print "type ok"
#
#
# m = mytest()
# m.func_test()
#
# i = iter('abcd')
#
# for index in i:
#     print index
#
# re1 = map(lambda x,y:x+y,[1,2,3],[4,5,6])
# print re1
# re1 = reduce(lambda x,y:x+y,[1,2,3,4])
# print re1
#
# import  re
#
# method = re.compile("ls")
# result = method.findall("ls,nihao,ls");
# print result
#
# result = method.finditer("ls,nihao,ls");
# for i in result:
#     print i.group()
#
# result = method.match("ls,nihao,ls")
# print result.group()

# import subprocess
# import  sys
# import  os
# import  time
# child = subprocess.Popen("notepad")
#
# print "hello"
# print child.pid
#
# while True:
#     if(child.poll()):
#         break
#     else:
#         time.sleep(1)
#     print "1s"

# a=open("test.py", 'r')
# for i in a:
#     print i

# import sys
# input_string = sys.stdin.read(10)
# print input_string

# import StringIO
#
# string_file = StringIO.StringIO("hell,world\n,nihao")
# f = string_file.readline()
# print f
# f = string_file.read(9)
# print f


# import  urllib
# f_open = urllib.urlopen("http://www.baidu.com")
# document = f_open.readline()
# print document
# f_open.close()

# import  sys
#
# if __name__ == "__main__":
#     if not len(sys.argv) > 1 :
#         print __doc__
#     print sys.argv[1]

# import  re
# m = re.match(r"(?P\w+) (?P\w+)", "Malcolm Reynolds")
# m.groupdict()
# print m
#
# re.MULTILINE

# import shelve
# shelve_file = shelve.open("hello.shelve")
# print type(shelve_file)
# shelve_file['a'] = {'hello', 'world'}
# print shelve_file.keys()
# shelve_file.close()
#
# import socket
#
# def check_server(address, port):
#     s = socket.socket()
#     try:
#         s.connect((address, port))
#         print "connect to %s on %s" %(address, port)
#         return True
#     except socket.error, e:
#         print "connect is failure"
#         return  False
#
# if __name__ == "__main__":
#     from optparse import OptionParser
#     parser = OptionParser()
#     parser.add_option("-a", "--address", dest="address", default="localhost")
#     parser.add_option("-p", "--port", dest="port", default=80)
#
# (option, args) = parser.parse_args()
# print option
# print args
# type(option)
#
# class ttClass(object):
#     def __init__(self):
#         self.address = "www.hao123.com"
#         self.port = 80
#     def __str__(self):
#         return "%s, %s" %(self.address, self.port)
# a= ttClass()
# print a
#
#
# import httplib
# import sys
# def checkServerByHttplib(address, port, resource):
#     if  not resource.startswith('/'):
#         resource = '/' + resource
#     try:
#         http_connect = httplib.HTTPConnection(address, port)
#         print "connect successs"
#         http_connect.request("GET", resource)
#         responce = http_connect.getresponse()
#         print responce
#     except socket.error, e:
#         print "open failure"
#         return False
#     finally:
#         http_connect.close()
#         print "connection closed sucessfully"
#     if responce.status in [200,301]:
#         return True
#     return False
#
# checkServerByHttplib("111.13.100.92", 80, '/')
# check_server(option.address, option.port)

#
# def mult_arg(args1, args2):
#     print args1
#
# mult_arg(*("ni", "hao"))


# XML RPC

# import  SimpleXMLRPCServer
# import os
# def ls(directory):
#     print os.listdir(directory)
# def pwd():
#     print os.curdir()
#
# if __name__ == "__main__":
#     s = SimpleXMLRPCServer.SimpleXMLRPCServer(("127.0.0.1", 8080))
#     s.register_function(ls)
#     s.register_function(pwd)
#     s.serve_forever()
#
# import xmlrpclib
# x = xmlrpclib.ServerProxy("http://127.0.0.1:8080")

# import os
# print os.curdir
# print os.getcwd()
# print os.stat("test.py")

# os.mkdir("tmp")
# os.makedirs("tmp/hello/world")
#
# import shutil
# shutil.copytree("tmp", "tmp1")

# for dirpath, dirnames, filename in os.walk("."):
#     # print dirpath
#     # print dirnames
#      print filename


# import os
# import tarfile
#
# tar = tarfile.open("test.tar.bz2", "r|bz2")
# for dir, path, files in os.walk('.'):
#     for file in files:
#         fullpath = os.path.join(dir, file)
#         tar.add(fullpath)
#
#
# tar.close()

# tar.list()


# a = 'abcdefg'
# for i in range(0, len(a)):
#     print i
#
# print '======='
#
# for (index, value) in enumerate(a):
#     print index
#     print value
#
# print '========'
#
# la = [1,2,3,4,5,6,7]
# lb = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]
# for t in zip(la, lb, a):
#     print t


# def gen():
#     for i in range(4):
#         yield i
#
# for j in gen():
#     print j
#
# i = iter('abcd')
# for j in i:
#     print j
#
# try:
#     2/0
# except:
#     print 'error'
# else:
#     print 'normal'
# finally:
#     print 'over'

# class My_TT:
#     def __init__(self):
#         self.a = 10
#     def show(self):
#         print self.a
#
# t = My_TT()
# print hasattr(t, 'a')
# a = getattr(t, 'show')
# a()



# func = lambda x,y: x + y
# print func(1,2)
#
# print map(func, [1,2,3], [4,5,6])
#
# print reduce(func,[1,2,4,5])
#
# def func(a):
#     if a > 100:
#         return True
#     else:
#         return False
#
# print filter(func, [100,200])

#
# import time
# import thread
#
# def timer(no, interval):
#     cnt = 0
#     while cnt < 10:
#         print "thread: %d, time: %s" %(no , time.ctime())
#         time.sleep(interval)
#     thread.exit_thread()
# try:
#     thread.start_new_thread(timer, (1,1))
#     thread.start_new_thread(timer, (2,1))
# except:
#     print 'error'
# else:
#     print 'normal'
# finally:
#     print 'over'

# import subprocess
# import time
# # subprocess.call("notepad")
#
# child = subprocess.Popen("dir", stdout = subprocess.PIPE, shell=True)
# while child.poll() == None:
#     time.sleep(1)
#     print "kill1"
#     child.kill()

# print child.stdout.read()

# import threading
# import  time
# count = 1
# class KissThread(threading.Thread):
#     def run(self):
#         global count
#         print "Thread: %s, count: %d" %(self.name, count)
#         count += 1
# for i in range(5):
#     KissThread().start()
#
# from threading import Thread
# import time
# def thread_func(i, data):
#     print "Thread ID: %s" %Thread.name
#     print "Thread Data: %s" %data
#
# for i in range(5):
#     work = Thread(target = thread_func, args = (1,"wang"))
#     work.start()
#
# from Queue import Queue
# q = Queue()
# q.task_done()
# q.join()


# from threading import Timer
# import  time
# import  sys
#
# def hello():
#     print "timer out"
#
# t = Timer(3, hello)
# t.start()
#
# for i in range(5):
#     print 'i: %d' %i
#     time.sleep(1)


# import optparse
# parse = optparse.OptionParser()
# parse.add_option("--address", '-a', default = "192.168.1.1")
# parse.add_option("--port", '-p', default =80)
#
# (option, argument) = parse.parse_args()
#
# print option.address
# print option.port

def opthelp():
    print 'opthelp 1234'

import optparse
p = optparse.OptionParser(version='0.1', description='test',  usage =opthelp )
p.add_option("--verbose", '-v', default=False)
option, argument = p.parse_args()
print option.verbose